package org.dydl.model.system;

import javax.persistence.*;
import java.math.BigDecimal;

/**
 * Created by Jack on 2018/1/30.
 */
@Entity
@Table(name = "materials_purchase_detail", schema = "saiqi_psi", catalog = "")
public class MaterialsPurchaseDetail {
    private int id;
    private String goodsUuid;
    private String purchaseSingleNo;
    private String name;
    private String model;
    private String unit;
    private Integer totalQuantity;
    private BigDecimal unitPrice;
    private Integer amount;
    private String currency;
    private BigDecimal taxRate;
    private String color;

    @Id
    @Column(name = "ID")
    @GeneratedValue(strategy = GenerationType.AUTO)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "GOODS_UUID")
    public String getGoodsUuid() {
        return goodsUuid;
    }

    public void setGoodsUuid(String goodsUuid) {
        this.goodsUuid = goodsUuid;
    }

    @Basic
    @Column(name = "PURCHASE_SINGLE_NO")
    public String getPurchaseSingleNo() {
        return purchaseSingleNo;
    }

    public void setPurchaseSingleNo(String purchaseSingleNo) {
        this.purchaseSingleNo = purchaseSingleNo;
    }

    @Basic
    @Column(name = "NAME")
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Basic
    @Column(name = "MODEL")
    public String getModel() {
        return model;
    }

    public void setModel(String model) {
        this.model = model;
    }

    @Basic
    @Column(name = "UNIT")
    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    @Basic
    @Column(name = "TOTAL_QUANTITY")
    public Integer getTotalQuantity() {
        return totalQuantity;
    }

    public void setTotalQuantity(Integer totalQuantity) {
        this.totalQuantity = totalQuantity;
    }

    @Basic
    @Column(name = "UNIT_PRICE")
    public BigDecimal getUnitPrice() {
        return unitPrice;
    }

    public void setUnitPrice(BigDecimal unitPrice) {
        this.unitPrice = unitPrice;
    }

    @Basic
    @Column(name = "AMOUNT")
    public Integer getAmount() {
        return amount;
    }

    public void setAmount(Integer amount) {
        this.amount = amount;
    }

    @Basic
    @Column(name = "CURRENCY")
    public String getCurrency() {
        return currency;
    }

    public void setCurrency(String currency) {
        this.currency = currency;
    }

    @Basic
    @Column(name = "TAX_RATE")
    public BigDecimal getTaxRate() {
        return taxRate;
    }

    public void setTaxRate(BigDecimal taxRate) {
        this.taxRate = taxRate;
    }

    @Basic
    @Column(name = "COLOR")
    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MaterialsPurchaseDetail that = (MaterialsPurchaseDetail) o;

        if (id != that.id) return false;
        if (goodsUuid != null ? !goodsUuid.equals(that.goodsUuid) : that.goodsUuid != null) return false;
        if (purchaseSingleNo != null ? !purchaseSingleNo.equals(that.purchaseSingleNo) : that.purchaseSingleNo != null)
            return false;
        if (name != null ? !name.equals(that.name) : that.name != null) return false;
        if (model != null ? !model.equals(that.model) : that.model != null) return false;
        if (unit != null ? !unit.equals(that.unit) : that.unit != null) return false;
        if (totalQuantity != null ? !totalQuantity.equals(that.totalQuantity) : that.totalQuantity != null)
            return false;
        if (unitPrice != null ? !unitPrice.equals(that.unitPrice) : that.unitPrice != null) return false;
        if (amount != null ? !amount.equals(that.amount) : that.amount != null) return false;
        if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false;
        if (taxRate != null ? !taxRate.equals(that.taxRate) : that.taxRate != null) return false;
        if (color != null ? !color.equals(that.color) : that.color != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (goodsUuid != null ? goodsUuid.hashCode() : 0);
        result = 31 * result + (purchaseSingleNo != null ? purchaseSingleNo.hashCode() : 0);
        result = 31 * result + (name != null ? name.hashCode() : 0);
        result = 31 * result + (model != null ? model.hashCode() : 0);
        result = 31 * result + (unit != null ? unit.hashCode() : 0);
        result = 31 * result + (totalQuantity != null ? totalQuantity.hashCode() : 0);
        result = 31 * result + (unitPrice != null ? unitPrice.hashCode() : 0);
        result = 31 * result + (amount != null ? amount.hashCode() : 0);
        result = 31 * result + (currency != null ? currency.hashCode() : 0);
        result = 31 * result + (taxRate != null ? taxRate.hashCode() : 0);
        result = 31 * result + (color != null ? color.hashCode() : 0);
        return result;
    }
}
